Skip to content

fix: prevent Flexible wrapping on shrink-0 children in justify-between rows#47

Merged
anilcancakir merged 2 commits intov1from
fix/flex1-justify-between-wrapping
Mar 31, 2026
Merged

fix: prevent Flexible wrapping on shrink-0 children in justify-between rows#47
anilcancakir merged 2 commits intov1from
fix/flex1-justify-between-wrapping

Conversation

@anilcancakir
Copy link
Copy Markdown
Collaborator

Summary

Fixes #45flex-1 + justify-between space distribution broken by incorrect Flexible wrapping in Row.

  • Added _hasShrinkZero check to skip Flexible wrapping for shrink-0 children in container-level Row wrapping logic (w_div.dart)
  • Removed incorrect shrink-0 → FlexFit.tight mapping from _flexFitMap (flexbox_grid_parser.dart) — shrink-0 now correctly preserves intrinsic size with no wrapper
  • Updated docs and changelog to reflect corrected shrink-0 semantics

Test plan

  • 2 new widget tests: flex-row justify-between + flex-1 + shrink-0 child not wrapped
  • 1 new parser test: shrink-0 does not set flexFit
  • 4 existing parser tests updated for corrected assertions
  • Full suite: 925/925 tests pass
  • dart analyze: zero issues

…n rows (#45)

Container-level wrapping logic incorrectly wrapped all non-flex children
with Flexible when using justify-between, breaking space distribution
when combined with flex-1. Add _hasShrinkZero check to skip wrapping
shrink-0 children and remove incorrect shrink-0 → FlexFit.tight parser
mapping — shrink-0 now correctly preserves intrinsic size.
Copilot AI review requested due to automatic review settings March 31, 2026 18:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an issue where justify-between rows with a flex-1 child would distribute space incorrectly because non-flex children were being wrapped in Flexible, and updates shrink-0 semantics accordingly.

Changes:

  • Updated WDiv Row child-wrapping logic to skip Flexible wrapping for shrink-0 children when space distribution/overflow logic is enabled.
  • Removed the shrink-0 -> FlexFit.tight mapping so shrink-0 no longer sets flexFit.
  • Updated docs/changelog and adjusted/added tests to reflect the corrected behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/src/widgets/w_div.dart Skips container-level Flexible wrapping for shrink-0 children in Row builds.
lib/src/parser/parsers/flexbox_grid_parser.dart Removes shrink-0 from _flexFitMap so it no longer sets flexFit.
test/widgets/w_div/flex_shrink_test.dart Adds widget tests asserting shrink-0 children aren’t wrapped with Flexible under justify-between.
test/parser/parsers/flexbox_grid_parser_test.dart Updates expectations so shrink-0 does not set flexFit and adjusts override assertions.
doc/layout/flexbox.md Updates documentation to state shrink-0 preserves intrinsic size with no wrapper.
CHANGELOG.md Adds unreleased bug-fix entries for #45.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…erBox assertion

- _hasShrinkZero now tokenizes by whitespace and matches full tokens
  (bare shrink-0 and prefixed variants like md:shrink-0)
- Removed duplicate shrink-0 parser test
- Widget test now verifies intrinsic size via RenderBox instead of
  re-checking Flexible wrapping
@anilcancakir anilcancakir merged commit cd5700c into v1 Mar 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants